package WaiBao;

import java.util.Arrays;

public class ChenMeng {
    public static void main(String[] args) {
        String[] xingming = {"唐小芳(班长)", "凌长辉(副班长)", "小李(学习委员)", "付兵(团支书)", "温馨", "李颖", "冯廷光", "王明菊", "李小村", "曹永红", "罗奔波", "郭志全",
                "李敏", "许文燕", "赵丽艳", "程咬金", "易小花", "宋永健", "王晓丽", "杨凌", "李静瑶", "李小春", "李静瑶", "周志玲", "夏燕", "冯淑清", "谭建春", "向玉兰",
                "安琪拉", "程梦(学生)"};//考生本人: 程梦(学生)
        int[] nianling = {22, 21, 20, 19,19, 18, 19, 20, 19, 19,19, 20, 18, 20, 20, 19, 18, 18, 18, 18, 19, 19, 20, 20, 20, 18, 19, 19, 18, 19};//考生年龄：19岁
        double[] chengji1 = {86, 96, 64, 90, 61, 79, 88, 89, 77, 91, 93, 77, 85, 79, 65, 68, 69, 99, 96, 88, 92, 91, 95, 88, 75, 74, 78, 74, 80, 95};
        double[] chengji2 = {68, 75, 89, 76, 78, 2, 81, 89, 94, 80, 91, 77, 86, 75, 65, 65, 86, 79, 66, 68, 92, 71, 95, 85, 75, 84, 79, 64, 90, 94};
        double[] chengji3 = {81, 66, 91, 85, 71, 69, 78, 89, 80, 68, 93, 87, 85, 75, 65, 68, 69, 69, 96, 93, 92, 81, 95, 95, 79, 84, 77, 71, 89, 96};

        double zuihoudefen;//代表每个学生的总分
        double jisuanpingjunfen;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            zuihoudefen = chengji1[i] + chengji2[i] +chengji3[i];
//            jisuanpingjunfen = ( zuihoudefen * 1.0) / 3;
//            System.out.println(xingming[i] + "的总分为:" + zuihoudefen);
//            System.out.println(xingming[i] + "的平均分为:" +jisuanpingjunfen);
//        }



        double qiuhe = 0, chengzi = 0;
        double[] chunfnag = new double[30];
//        for (int i = 0; i < 30; i++) {
//            qiuhe = chengji1[i] + chengji2[i] + chengji3[i];
//           jisuanpingjunfen = (qiuhe * 1.0) / 3;
//            chunfnag[i] = jisuanpingjunfen;
//        }
//
//        for (int i = 0; i < chunfnag.length - 1; i++) {
//            for (int j = 0; j < chunfnag.length - i - 1; j++) {
//                if (chunfnag[j] < chunfnag[j + 1]) {
//                    double tep = chunfnag[j];
//                    chunfnag[j] =chunfnag[j + 1];
//                    chunfnag[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(chunfnag[i]);
//        }



        double one1 = 0,one2 = 0, one3 = 0;//计算每门课的平均分
        double two1 = 0,two2 = 0, two3 = 0;//计算每门课标准差
        double three1 = 0, three2 = 0,  three3 = 0;//计算每门课中位数
        double sum2 = 0;
        for (int i = 0; i < chengji1.length; i++) {
            sum2+=chengji1[i];
        }
        one1 = (sum2*1.0)/30;
        System.out.println("生物化学的班级平均分为:"+one1);
        double Sum = 0;
        for (int i = 0; i < chengji2.length; i++) {
            Sum+=chengji2[i];
        }
        one2 = (Sum*1.0)/30;
        System.out.println("微生物学的班级平均分为:"+one2);
        double sum = 0;
        for (int i = 0; i <chengji3.length; i++) {
            sum+=chengji3[i];
        }
        one3 = (sum*1.0)/30;
        System.out.println("人体组织解剖学的班级平均分为:"+one3);


//
        double c1 = 0,c2 = 0,c3 = 0;
        for (int i = 0; i <chengji1.length; i++) {
            c1+= (chengji1[i] -one1)*(chengji1[i] - one1);
        }
        two1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:"+two1);

        for (int i = 0; i < chengji2.length; i++) {
            c2+= (chengji2[i] - one2)*(chengji2[i] - one2);
        }
        two2 = Math.sqrt(c2*1.0/30);
        System.out.println("微生物学的班级标准差为:"+two2);

        for (int i = 0; i < chengji3.length; i++) {
            c3+= (chengji3[i] -one3)*(chengji3[i] - one3);
        }
        two3 = Math.sqrt(c3*1.0/30);
        System.out.println("人体组织解剖学的班级标准差为:"+two3);
//
//
//        Arrays.sort(chengji1);
//        Arrays.sort(chengji2);
//        Arrays.sort(chengji3);
//        three1 =( chengji1[14]+chengji1[15])*1.0/2;
//        three2 =( chengji2[14]+chengji2[15])*1.0/2;
//        three3 =( chengji3[14]+chengji3[15])*1.0/2;
//        System.out.println("生物化学的中位数为:"+ three1);
//        System.out.println("微生物学的中位数为:"+ three2);
//        System.out.println("人体组织解剖学的中位数为:"+ three3);

    }
}
